package nyist.media.bean.admin;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import nyist.media.bean.BaseBean;
import nyist.media.entity.admin.Admin;
import nyist.media.utils.DateUtil;

import java.sql.Timestamp;
import java.util.Date;

/**
 * @author dcf
 * @date 2018/12/23
 */
@Getter
@Setter
@NoArgsConstructor
public class AdminListBean extends BaseBean {

    private static final long serialVersionUID = -8295975399043628092L;

    private Long id;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 姓名
     */
    private String name;

    /**
     * 用户名
     */
    private String username;

    /**
     * 锁定到期时间
     */
    @JSONField(format = DateUtil.DATETIME_FULL_FORMATTER_STR)
    private Timestamp lockIn;

    /**
     * 是否可用
     */
    private boolean enabled;

    /**
     * 创建时间
     */
    @JSONField(format = DateUtil.DATETIME_FULL_FORMATTER_STR)
    private Date createDate;

    /**
     * 手机号
     */
    private String phone;

    public AdminListBean(Admin admin) {
        this.id = admin.getId();
        this.name = admin.getName();
        this.username = admin.getUsername();
        this.lockIn = admin.getLockIn();
        this.createDate = admin.getCreateDate();
        this.enabled = admin.isEnabled();
        this.email = admin.getEmail();
        this.phone = admin.getPhone();
    }
}
